//
//  M_Matrial_CollectionViewCell.swift
//  MyFood
//
//  Created by dllo on 16/2/20.
//  Copyright © 2016年 XRG. All rights reserved.
//

import UIKit

class M_Matrial_CollectionViewCell: UICollectionViewCell, UICollectionViewDelegate, UICollectionViewDataSource{

    var materialSmaArr : Array<F_Material_Second_Collection_Model>!{
        didSet{
            
            self.materialSmaArr = materialSmaArr!
            self.cellCollection.reloadData()
        }
    }

    @IBOutlet weak var cellCollection: UICollectionView!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
    self.cellCollection.delegate  = self
    self.cellCollection.dataSource = self
        self.cellCollection.backgroundColor = UIColor.whiteColor()
    self.cellCollection.registerNib(UINib(nibName: "M_CellCollection_CollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "cell")
        // Initialization code
    }

    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {

            return materialSmaArr.count
    }

    

    func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
        let cell : M_CellCollection_CollectionViewCell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! M_CellCollection_CollectionViewCell
        let model = self.materialSmaArr[indexPath.row]
        cell.title.text = model.text
        return cell
    }
}
